<?php
class CustomerOrderProductEntityBase extends EntityBase
{
	public $id;
	public $orders_id;
	public $products_id;
	public $products_model;
	public $products_name;
	public $products_price;
	public $final_price;
	public $products_tax;
	public $products_quantity;
	
	const INACTIVE = 0;
	const ACTIVE = 1;
	public function __construct($arrValue = null, $prefix = '')
	{
		if(!is_null($arrValue) && is_array($arrValue))
		{
			$this->id = (int) ($arrValue[$prefix . 'id']);			
			$this->orders_id = strval ($arrValue[$prefix . 'orders_id']);
			$this->products_id = strval ($arrValue[$prefix . 'products_id']);
			$this->products_model = strval ($arrValue[$prefix . 'products_model']);
			$this->products_name = strval ($arrValue[$prefix . 'products_name']);
			$this->products_price = strval ($arrValue[$prefix . 'products_price']);
			$this->products_quantity = strval ($arrValue[$prefix . 'products_quantity']);
			$this->products_tax = strval ($arrValue[$prefix . 'products_tax']);
			$this->final_price = strval ($arrValue[$prefix . 'final_price']);
		}
	}

	/**
	 * Get status name of users
	 *
	 * @access public
	 *
	 * @return string name of status
	 *
	 */
	public function getStatusName()
	{
		$arrStatusList = self::getStatusList();
		return isset($arrStatusList["{$this->status}"]) ? $arrStatusList["{$this->status}"] : '';
	}

	/**
	 * Get list of users status
	 *
	 * @access public
	 *
	 * @return array of users status
	 *
	 */
	public static function getStatusList()
	{
		return array(self::INACTIVE	=> 'INACTIVE',
		self::ACTIVE 	=>'ACTIVE'		
		);
	}

	/**
	 * Get all fields for selecting columns
	 *
	 * @param string $alias: alias of table
	 * @param string $prefix
	 * @return string
	 */
	public static function getSelectColumns($alias, $prefix = '')
	{
		$arrValue = array(
						"{$alias}.id AS `{$prefix}id`",
						"{$alias}.orders_id AS `{$prefix}orders_id`",
						"{$alias}.products_id AS `{$prefix}products_id`",
						"{$alias}.products_model AS `{$prefix}products_model`",
						"{$alias}.products_name AS `{$prefix}products_name`",
						"{$alias}.products_price AS `{$prefix}products_price`",
						"{$alias}.products_quantity AS `{$prefix}products_quantity`",
						"{$alias}.products_tax AS `{$prefix}products_tax`",
						"{$alias}.final_price AS `{$prefix}final_price`"
		);

		return implode(',', $arrValue);
	}
}